﻿/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 *  
 **/

using Peter.Common.Interfaces;
using Peter.Common.MainMenu;

namespace Peter.Common
{
   /// <summary>
   /// An item that will be added to the quick open list.
   /// </summary>
   public class QuickOpenItem
   {
      /// <summary>
      /// Initializes a new quick open item.
      /// </summary>
      /// <param name="provider"></param>
      public QuickOpenItem (IQuickOpenProvider provider)
      {
         this.Icon = MainMenuIcon.None;
         this.Provider = provider;
      }

      /// <summary>
      /// Gets the header for the quick open item.
      /// </summary>
      public string Header
      {
         get { return this.Provider.Title; }
      }

      /// <summary>
      /// Gets the quick open provider
      /// </summary>
      public IQuickOpenProvider Provider { get; private set; }

      /// <summary>
      /// Gets or Sets the icon for the quick open item.
      /// </summary>
      public MainMenuIcon Icon { get; set; }

      /// <summary>
      /// Gets or Sets the tooltip for the quick open item.
      /// </summary>
      public string Tooltip { get; set; }

      /// <summary>
      /// Gets or Sets the text to display for the quick open item.
      /// </summary>
      public string Text { get; set; }

      /// <summary>
      /// Gets or Sets a unique key to associate the item with.
      /// </summary>
      public string Key { get; set; }

      /// <summary>
      /// Gets or Sets any additional data to associated with the quick open item.
      /// </summary>
      public object Tag { get; set; }

      /// <summary>
      /// Executes this item.
      /// </summary>
      /// <returns>The results of the quick open.</returns>
      public QuickOpenResults Execute ()
      {
         return this.Provider.Open (this);
      }
   }
}
